home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / HDX_BACK / HDX302.ST / CHECK.S < prev    next >
Encoding:
Text File  |  2001-02-09  |  2.4 KB  |  81 lines

  1. ;+
  2. ;  CHECK.S - check for existence of different components in system.
  3. ;-
  4.  
  5. .include    "defs.h"
  6. .include    "68030.s"
  7.  
  8. REGBASE    equ    1            ; most are on odd part of data bus
  9. bSCSI    equ    $FFFF8780+REGBASE
  10.  
  11. ;+
  12. ; chkscsi() - Check if SCSI exists
  13. ;
  14. ; Uses: d0, d1, d2, a0, a1
  15. ;-
  16.     .globl    _chkscsi
  17. _chkscsi:                ; check if SCSI exists
  18.     move.l    #0,savssp        ; no stack pointer is saved yet
  19.     move.l    #1,-(sp)        ; find out what mode processor is in
  20.     move.w    #$20,-(sp)        ; Super(1L)
  21.     trap    #1
  22.     addq.w    #6,sp            ; clean up stack
  23.     tst.w    d0            ; in Supervisor mode already?
  24.     bne.s    tscsi            ; if so, go test for SCSI
  25.     clr.l    -(sp)            ; else go to Supervisor mode
  26.     move.w    #$20,-(sp)        ; Super(0L)
  27.     trap    #1
  28.     addq.w    #6,sp            ; clean up stack
  29.     move.l    d0,savssp        ; save original stack pointer
  30. tscsi:    clr.w    result            ; assume SCSI doesn't exist
  31.     movea.l    BERR,a0            ; save original bus error vector
  32.     move.l    #nscsi,BERR        ; install our own vector
  33.     movea.l    sp,a1            ; save current stack pointer
  34.     move.b    bSCSI,d1        ; try to access the SCSI bus
  35.     move.w    #1,result        ; if no bus error, SCSI exists
  36. nscsi:    move.l    a0,BERR            ; restore original bus error vector
  37.     move.l    a1,sp            ; restore stack pointer
  38. chkret:    tst.l    savssp            ; were we in User mode when started?
  39.     beq.s    tend            ; if not, just return
  40.     move.l    savssp,-(sp)        ; go back to User mode 
  41.     move.w    #$20,-(sp)        ; Super(savssp)
  42.     trap    #1
  43.     addq.w    #6,sp            ; clean up stack
  44. tend:    move.w    result,d0        ; d0 = result
  45.     rts
  46.  
  47.  
  48. ;+
  49. ; chkcache() - Check if '030 cache exists
  50. ;
  51. ; Uses: d0, d1, d2, a0, a1
  52. ;-
  53.     .globl    _chkcache
  54. _chkcache:                ; check if '030 cache exists
  55.     move.l    #0,savssp        ; no stack pointer is saved yet
  56.     move.l    #1,-(sp)        ; find out what mode processor is in
  57.     move.w    #$20,-(sp)        ; Super(1L)
  58.     trap    #1
  59.     addq.w    #6,sp            ; clean up stack
  60.     tst.w    d0            ; in Supervisor mode already?
  61.     bne.s    tcache            ; if so, go test for cache
  62.     clr.l    -(sp)            ; else go to Supervisor mode
  63.     move.w    #$20,-(sp)        ; Super(0L)
  64.     trap    #1
  65.     addq.w    #6,sp            ; clean up stack
  66.     move.l    d0,savssp        ; save original stack pointer
  67. tcache:    clr.w    result            ; assume cache doesn't exist
  68.     movea.l    IINS,a0            ; save orig illegal instrn vector
  69.     move.l    #ncache,IINS        ; install our own vector
  70.     movea.l    sp,a1            ; save current stack pointer
  71.     movecacrd0            ; does a cache exist?
  72.     move.w    #1,result        ; if so, set result
  73. ncache:    move.l    a0,IINS            ; restore orig illegal instrn vector
  74.     move.l    a1,sp            ; restore stack pointer
  75.     bra    chkret
  76.  
  77.  
  78. .bss
  79. savssp:    ds.l    1            ; stack pointer
  80. result:    ds.w    1
  81.